<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ include file="../header.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${systemName }</title>
    <link rel="shortcut icon" href="${contextPath}/resources/favicon.ico"> 
    <link href="${contextPath}/resources/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${contextPath}/resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="${contextPath}/resources/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="${contextPath}/resources/css/animate.min.css" rel="stylesheet">
    <link href="${contextPath}/resources/css/style.min.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
       <div class="ibox-content">
        <form action="${contextPath}/system/order/list" class="form-horizontal" name="searchFrom"> 
        	<div class="form-group">
                <label class="col-sm-2 control-label">订单号:</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" name="orderNo" value="${param.orderNo }">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">订单状态</label>
                <div class="col-sm-10">
                    <select class="form-control m-b" name="orderStatus">
                    	 <option value="-100">所有 </option>
                        <option value="-1">已取消</option>
                        <option value="-2">过期取消</option>
                        <option value="0">待付款</option>
                        <option value="1">待收货</option>
                        <option value="2">已发货</option>
                        <option value="3">已完成</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                 <div class="col-sm-4 col-sm-offset-2">
                     <button class="btn btn-primary" type="submit">查找</button>
                 </div>
             </div>
        
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <table class="table table-striped table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>订单号</th>
                                    <th>订单标题</th>
                                    <th>用户ID</th>
                                    <th>商品数目</th>
                                    <th>订单金额</th>
                                    <th>运费</th>
                                    <th>总金额</th>
                                     <th>订单状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
	                            <c:forEach items="${page.resultRows}" var="order" varStatus="vs">  
								        <tr>  
								             <td>${order.id}</td>  
								             <td>${order.orderNo}</td>  
								             <td>
								             	<c:choose>
												    <c:when test="${fn:length(order.orderTitle) > 10}">
												     	<c:out value="${fn:substring(order.orderTitle, 0, 10)}......" />
												    </c:when>
												    <c:otherwise>
												    	 <c:out value="${order.orderTitle}" />
												    </c:otherwise>
												</c:choose>
								             </td>  
								             <td>${order.userId}</td>
										     <td>${order.goodsNumber }</td> 
										     <td>${order.orderPayee }</td> 
										     <td>${order.shippingPayee }</td> 
										     <td>${order.totalPayee }</td>
										     <td>
								             	<c:choose>
								             		<c:when test="${order.orderStatus == -1 }">已取消</c:when>
								             		<c:when test="${order.orderStatus == -2 }">过期取消</c:when>
								             		<c:when test="${order.orderStatus == 0 }">待付款</c:when>
								             		<c:when test="${order.orderStatus == 1 }">待收货</c:when>
								             		<c:when test="${order.orderStatus == 2 }">已发货</c:when>
								             		<c:when test="${order.orderStatus == 3 }">已完成</c:when>
								             	</c:choose>
								             </td>  
										     <td>
										     	<a href="${contextPath}/system/order/detail/${order.id}" class="btn btn-primary">查看</a>
										     	<c:choose>
								             		<c:when test="${order.orderStatus == -1 }"></c:when>
								             		<c:when test="${order.orderStatus == -2 }"></c:when>
								             		<c:when test="${order.orderStatus == 0 }">
								             			<a href="${contextPath}/system/order/detail/${order.id}" class="btn btn-primary">取消订单</a>
								             		</c:when>
								             		<c:when test="${order.orderStatus == 1 }">
								             			<a href="${contextPath}/system/order/detail/${order.id}" class="btn btn-primary">发货</a>
								             		</c:when>
								             		<c:when test="${order.orderStatus == 2 }">
								             			<a href="${contextPath}/system/order/detail/${order.id}" class="btn btn-primary">完成订单</a>
								             		</c:when>
								             		<c:when test="${order.orderStatus == 3 }"></c:when>
								             	</c:choose>
										     </td> 
								         </tr>  
								</c:forEach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <jsp:include page="../page.jsp">
              <jsp:param value="searchFrom" name="formName" />
        </jsp:include>
        </form>
        </div>
    </div>
    <script src="${contextPath}/resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="${contextPath}/resources/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="${contextPath}/resources/js/plugins/jeditable/jquery.jeditable.js"></script>
    <script src="${contextPath}/resources/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="${contextPath}/resources/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="${contextPath}/resources/js/content.min.js?v=1.0.0"></script>
</body>
</html>
